# find
string_example = 'hello world itheima an itheimaApp'
index = string_example.find('itheima')
print(index)
print(string_example.find('hujing'))

print('-'*15)
# index
string_example = 'hello world itheima an itheimaApp'
index = string_example.index('itheima')
print(index)
# print(string_example.index('hujing'))

print('-'*15)
# count
string_example = 'hello world itheima an itheimaApp'
result = string_example.count('itheima')
print(result)

print('-'*15)
# replace
old_string = 'hello world itheima an itheimaApp'
new_string = old_string.replace('itheima', 'ITHEIMA', 1)
new2_string = old_string.replace('itheima', 'ITHEIMA')
print(new_string)
print(new2_string)

print('-'*15)
# split
string_example = 'this is string example...wow!!!'
print(string_example.split( ))
print(string_example.split('i', 1))
print(string_example.split('w'))

print('-'*15)
# capitalize
old_string = 'hello world itheima an itheimaApp'
new_string = old_string.capitalize()
print(new_string)

print('-'*15)
# title
old_string = 'hello world itheima an itheimaApp'
new_string = old_string.title()
print(new_string)

print('-'*15)
# startswith
old_string = 'hello world itheima an itheimaApp'
new1_string = old_string.startswith('hello')
print(new1_string)
new2_string = old_string.startswith('Hello')
print(new2_string)

print('-'*15)
# endswith
old_string = 'hello world itheima an itheimaApp'
new1_string = old_string.endswith('app')
print(new1_string)
new2_string = old_string.endswith('App')
print(new2_string)

print('-'*15)
# upper and lower
old_string = 'hello world itheima an itheimaApp'
new1_string = old_string.upper()
new2_string = old_string.lower()
print(new1_string)
print(new2_string)

print('-'*15)
# ljust and rjust
string_example = 'this is string example...wow!!!'
print(string_example.ljust(50, '*'))
print(string_example.rjust(50,'!'))

print('-'*15)
# center
old_string = 'hello world itheima an itheimaApp'
new_string = old_string.center(50)
print(new_string)
print(old_string.center(40, '*'))

print('-'*15)
# lstrip and rstrip
print('lstrip')
old_string1 = '    hello world itheima an itheimaApp'
old_string2 = '                hello world itheima an itheimaApp'
new1_string = old_string1.lstrip().lstrip('h')
new2_string = old_string2.lstrip()
print(new1_string)
print(new2_string)
print('-'*15)
print('rstrip')
old_string = '    hello world itheima an itheimaApp----****'
new_string = old_string.rstrip()
print(new_string)
new_string = new_string.rstrip('*')
print(new_string)
new_string = new_string.rstrip('-')
print(new_string)

print('-'*15)
# strip
old_string = '******-------++  hello world itheima an itheimaApp ==----****'
print(old_string)
new_string = old_string.strip('*')
print(new_string)
new_string = new_string.strip('-')
print(new_string)
new_string = new_string.strip('+')
print(new_string)
new_string = new_string.strip('=')
print(new_string)

print('-'*15)
# join
a='I love algorithm !'
print(' '.join(a))
print('-'.join(a))
print('*'.join(a))